package com.calculator.demo;

/**
 * @description: 计算器类，负责实际的计算
 * @author: YanXun
 * @date: 2023/3/6
 **/
public class Calculator {

    private int total=0;
    public void operation(char operator,int operand) {
        switch(operator) {
            case '+':
                total+=operand;
                break;
            case '-':
                total-=operand;
                break;
            case '*':
                total*=operand;
                break;
            case '/':
                total/=operand;
                break;
        }
        System.out.println(operator+" "+operand+" ="+total);
    }
}

